//
// Unihan Input Method
//
// Copyright © 2002-2007 Sun Wah Linux Ltd.
//
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
// USA
//
// $Id: context.h 757 2007-05-10 08:19:31Z roger $
//

#ifndef _CONTEXT_H
#define _CONTEXT_H

typedef struct _PreeditList {
	char **preedit;
	int num;
} PreeditList;

typedef struct _Context {
	Node *sentence;
	Node *currNode;
	Node *lastNode;
	Node *achorNode;
	int lenSentence; /* number of node */
	int cursor;	/* sentence cursor */
	//int preCursor;	/* preedit cursor */
	//char *result;	/* current search result */
} Context;

void context_init(Context *context);
void context_done(Context *context);

int context_key_stacked(Context *context,
		IMKeyEvent *kev,
		TableConfig *config,
		BaseTable *base_table,
		Adjuster *adjuster,
		PhraseTableList *phrase_table_list,
		int num_phrase_table);

int context_punctuation_stacked(Context *context,
			IMKeyEvent *kev,
			TableConfig *config);

int context_kick(Context *context,
		IMKeyEvent *kev,
		TableConfig *config,
		BaseTable *base_table,
		Adjuster *adjuster,
		PhraseTableList *phrase_table_list);

int context_is_kicked(Context *context);

int context_page_up(Context *context,
		TableConfig *config,
		BaseTable *base_table,
		Adjuster *adjuster,
		PhraseTableList *phrase_table_list);

int context_page_down(Context *context,
		TableConfig *config,
		BaseTable *base_table,
		Adjuster *adjuster,
		PhraseTableList *phrase_table_list);

int context_sel_up(Context *context,
		TableConfig *config,
		BaseTable *base_table,
		Adjuster *adjuster,
		PhraseTableList *phrase_table_list);

int context_sel_down(Context *context,
		TableConfig *config,
		BaseTable *base_table,
		Adjuster *adjuster,
		PhraseTableList *phrase_table_list);

int context_move_cursor_before(Context *context,
		TableConfig *config,
		BaseTable *base_table,
		Adjuster *adjuster,
		PhraseTableList *phrase_table_list);

int context_move_cursor_after(Context *context,
		TableConfig *config,
		BaseTable *base_table,
		Adjuster *adjuster,
		PhraseTableList *phrase_table_list);

int context_move_cursor_first(Context *context,
		TableConfig *config,
		BaseTable *base_table,
		Adjuster *adjuster,
		PhraseTableList *phrase_table_list);

int context_move_cursor_last(Context *context,
		TableConfig *config,
		BaseTable *base_table,
		Adjuster *adjuster,
		PhraseTableList *phrase_table_list);

#endif /* _CONTEXT_H */

// vi:ts=4:nowrap:cin:expandtab
